check if point is inside polygon python

39

#You can consider shapely, you need to install it with
# pip install Shapely

from shapely.geometry import Point
from shapely.geometry.polygon import Polygon

point = Point(0.5, 0.5)
polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])
print(polygon.contains(point))

Comments

Submit
0 Comments